﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Text;
using System.Text.RegularExpressions;
using WFinger.Config;
using WFinger.Model;

namespace WFinger.Publish
{
	public partial class LabelMass
	{
		public const string newLine = "\r\n";

		/// <summary>
		/// 解析表单
		/// </summary>
		/// <returns>解析成的html代码</returns>
		public string Analyse_SubForm()
		{
			string mystyle = this.Mass_Inserted;
			string formId = this.GetParamValue("FS:FormID");
			string styleid = Regex.Match(mystyle, @"\[\#FS:StyleID=(?<sid>[^\]]+)]", RegexOptions.Compiled).Groups["sid"].Value.Trim();
			if (!styleid.Equals(string.Empty))
			{
				mystyle = LabelStyle.GetStyleByID(styleid);
				return parse(mystyle, formId);
			}
			return "";
		}


		/// <summary>
		/// 实际解析方法
		/// </summary>
		/// <param name="mystyle">系统样式字符串</param>
		/// <param name="formid">表单编号</param>
		/// <returns>解析成的html代码</returns>
		private string parse(string mystyle, string formid)
		{
			if (mystyle == null || mystyle == string.Empty || mystyle == "")
			{
				return null;
			}
			else
			{
				//判断是否有验证码
				if (mystyle.IndexOf("{#form_ctr_Validate}") > -1)
				{
					if (hasvalidate(Convert.ToInt32(formid)))
					{
						string validate = "<input type=\"text\" id=\"CFValidate\" name=\"CFValidate\" /><img id=\"IMGValidCode\" width=\"70\" onclick=\"this.src='/comm/Image.aspx'\" src=\"/comm/Image.aspx\" alt=\"图片看不清？点击重新得到验证码\" style=\"cursor:pointer; height:23px;\" />";
						mystyle = mystyle.Replace("{#form_ctr_Validate}", validate);
					}
				}


				//替换表单项名
				MatchCollection formItems = Regex.Matches(mystyle, "\\{#form_item_([^\\}]+)\\}", RegexOptions.Compiled);
				foreach (Match item in formItems)
				{
					string test = item.Groups[1].Value;
					string info = searchitemname(test, formid);
					mystyle = mystyle.Replace(item.Value, info);
				}

				//替换表单所用控件
				MatchCollection formCtrs = Regex.Matches(mystyle, "\\{#form_ctr_([^\\}]+)\\}", RegexOptions.Compiled);
				foreach (Match item in formCtrs)
				{
					string test = item.Groups[1].Value;
					string[] infos = searchControl(test, formid);
					string info = makeControl(infos[0], infos[1], test, infos[2],infos[3]);
					mystyle = mystyle.Replace(item.Value, info);
				}

				//表单不需要值 ，替换成空
				MatchCollection formValues = Regex.Matches(mystyle, "\\{#form_value_([^\\}]+)\\}", RegexOptions.Compiled);
				foreach (Match item in formValues)
				{
					mystyle = mystyle.Replace(item.Value, "");
				}
			}
			mystyle = "<form id = \"Form" + formid + "\" name = \"Form" + formid + "\" method=\"post\" action=\"/customform/CustomFormSubmit.aspx\" enctype=\"multipart/form-data\"> <input id=\"CustomFormID\" name=\"CustomFormID\" type=\"hidden\" value=\"" + formid + "\" /> " + mystyle + "</form>";
			return mystyle;
		}


		/// <summary>
		/// 判断某一表单有无验证码
		/// </summary>
		/// <param name="formid">表单编号</param>
		/// <returns></returns>
		private bool hasvalidate(int formid)
		{
			WFinger.CMS.Label l = new WFinger.CMS.Label();
			return l.hasValidate(formid);
		}


		/// <summary>
		/// 制作控件
		/// </summary>
		/// <param name="type">控件类型</param>
		/// <param name="size">控件大小（能够设定大小的）</param>
		/// <param name="name">控件名称</param>
		/// <param name="selectitem">控件子元素（有子元素的控件）</param>
		/// <returns>控件所对应的html代码</returns>
		private string makeControl(string type, string size, string name, string selectitem,string defaultvalue)
		{
			char[] temp = "\r\n".ToCharArray();
			string html = string.Empty;
			switch (type)
			{
				case "SingleLineText":
					html += "<input id=\"CF_" + name + "\" name=\"CF_" + name + "\" type=\"text\" maxlength=\"" + size + "\" value=\""+defaultvalue+"\" />";
					break;
				case "MultiLineText":
					html += "<textarea id=\"CF_" + name + "\" name=\"CF_" + name + "\">"+defaultvalue+"</textarea>";
					break;
				case "PassWordText":
					html += "<input id=\"CF_" + name + "\" name=\"CF_" + name + "\" type=\"password\" maxlength=\"" + size + "\" />";
					break;
				case "DateTime":
					html += "<input id=\"CF_" + name + "\" name=\"CF_" + name + "\" type=\"text\"  value=\"" + defaultvalue + "\" maxlength=\"" + size + "\" />";
					break;

				case "RadioBox":
					string[] radioitems = selectitem.Split(temp);
					for (int i = 0; i < radioitems.Length; i++)
					{
						if (radioitems[i] == "")
						{
							continue;
						}
						if (radioitems[i] == defaultvalue)
						{
							html += "<input checked=\"checked\" type=\"radio\" name=\"CF_" + name + "\" value=\"" + radioitems[i] + "\" />" + radioitems[i] + "&nbsp;";
						}
						else
						{
							html += "<input type=\"radio\" name=\"CF_" + name + "\" value=\"" + radioitems[i] + "\" />" + radioitems[i] + "&nbsp;";
						}
					}
					break;

				case "CheckBox":
					string[] checkitems = selectitem.Split(temp);
					for (int i = 0; i < checkitems.Length; i++)
					{
						if (checkitems[i] == "")
						{
							continue;
						}
						html += "<input type=\"checkbox\" name=\"CF_" + name + "\" value=\"" + checkitems[i] + "\" />" + checkitems[i] + "&nbsp;";
					}
					break;

				case "Numberic":
					html += "<input id=\"CF_" + name + "\" name=\"CF_" + name + "\"  value=\"" + defaultvalue + "\" type=\"text\" maxlength=\"" + size + "\" />";
					break;

				case "UploadFile":
					html += "<input name=\"CF_" + name + "\"  value=\"" + defaultvalue + "\" type=\"file\" id=\"CF_" + name + "\" maxlength=\"" + size + "\" />";
					break;

				case "DropList":
					html += "<select name=\"CF_" + name + "\" id=\"CF_" + name + "\">";
					string[] items = selectitem.Split(temp);
					for (int i = 0; i < items.Length; i++)
					{
						if (items[i] == "")
						{
							continue;
						}
						if (items[i] == defaultvalue)
						{
							html += "<option value=\"" + items[i] + "\" selected=\"selected\">" + items[i] + "</option>";
						}
						else
						{
							html += "<option value=\"" + items[i] + "\">" + items[i] + "</option>";
						}
					}
					html += "</select>";
					break;

				case "List":
					html += "<select size=\"5\" name=\"CF_" + name + "\" id=\"CF_" + name + "\">";
					string[] listitems = selectitem.Split(temp);
					for (int i = 0; i < listitems.Length; i++)
					{
						if (listitems[i] == "")
						{
							continue;
						}
						if (listitems[i] == defaultvalue)
						{
							html += "<option value=\"" + listitems[i] + "\" selected=\"selected\">" + listitems[i] + "</option>";
						}
						else
						{
							html += "<option value=\"" + listitems[i] + "\">" + listitems[i] + "</option>";
						}
					}
					html += "</select>";
					break;

				default:
					break;
			}
			return html;
		}

		/// <summary>
		/// 查询表单某一表单元素中文名
		/// </summary>
		/// <param name="fieldname">表单元素名</param>
		/// <param name="formid">表单编号</param>
		/// <returns></returns>
		private string searchitemname(string fieldname, string formid)
		{
			WFinger.CMS.Label l = new WFinger.CMS.Label();
			return l.searchiteminfo(fieldname, formid);
		}


		/// <summary>
		/// 查询表单某一表单元素的控件类型
		/// </summary>
		/// <param name="fieldname">表单元素名</param>
		/// <param name="formid">表单编号</param>
		/// <returns></returns>
		private string[] searchControl(string fieldname, string formid)
		{
			WFinger.CMS.Label l = new WFinger.CMS.Label();
			return l.searchControlinfo(fieldname, formid);
		}


		/// <summary>
		/// 第一次解析分页列表
		/// </summary>
		/// <returns>产生一个展示用的div和请求数据的script的html代码</returns>
		public string Analyse_FormList()
		{
			int pagecount = 0;
			int recordCount = 0;
			string mystyle = this.Mass_Inserted;
			string pagesize = this.GetParamValue("FS:PageSize");
			string FormTableName = this.GetParamValue("FS:FormTableName");
			string styleid = Regex.Match(mystyle, @"\[\#FS:StyleID=(?<sid>[^\]]+)]", RegexOptions.Compiled).Groups["sid"].Value.Trim();
			if (!styleid.Equals(string.Empty))
			{
				string info = string.Empty;
				mystyle = LabelStyle.GetStyleByID(styleid);
				info = getControl(mystyle, FormTableName, pagesize.ToString(), out recordCount, out pagecount, 1);
				string id = styleid + "." + FormTableName + "." + pagesize + ".";
				info = "<div id=\"" + id + "\"></div><script src=\"/customform/CustomFormList.aspx?divid=" + id + "&pageindex=1\" type=\"text/javascript\" id=\"" + id + "_script\"></script>";
				return info;
			}
			pagecount = 0;
			recordCount = 0;
			return "";
		}

		/// <summary>
		/// 解析分页列表
		/// </summary>
		/// <param name="pageindex">当前页码</param>
		/// <param name="context">展示信息div的编号（包含列表样式编号，要查询的表名，每页大小）</param>
		/// <returns>当前页列表的信息和分页控件的html代码</returns>
		public string Analyse_FormList(int pageindex, string context)
		{
			int pagecount;
			int recordCount;
			string[] infos = context.Split('.');
			if (infos.Length != 4)
			{

				pagecount = 0;
				recordCount = 0;
				return "";
			}
			string mystyle = "";
			string FormTableName = infos[1];
			string pagesize = infos[2];
			string styleid = infos[0];
			if (!styleid.Equals(string.Empty))
			{
				int currentStart = 0;
				if (pageindex % 5 == 0)
				{
					currentStart = ((pageindex / 5) - 1) * 5 + 1;
				}
				else
				{
					currentStart = (pageindex / 5) * 5 + 1;
				}
				string info = string.Empty;
				mystyle = LabelStyle.GetStyleByID(styleid);
				info = getControl(mystyle, FormTableName, pagesize, out recordCount, out pagecount, pageindex);
				string pageControl = "<div class=\"foosun_customform_list\">" + info + "</div>";
				if (pagecount > 1)
				{
					pageControl += "<div style=\"padding-top:15px;\" class=\"foosun_pagebox\">";
					if (pageindex < 6)
					{
						pageControl += "<span class=\"foosun_pagebox_num\">上五页</span>";
					}
					else
					{
						pageControl += "<a href=\"javascript:JsReloader('" + context + "_script','/customform/CustomFormList.aspx?divid=" + context + "&pageindex=" + (currentStart - 5) + "' );void(0);\">上五页</a>";
					}
					if (pageindex > 1)
					{
						pageControl += "<a href=\"javascript:JsReloader('" + context + "_script','/customform/CustomFormList.aspx?divid=" + context + "&pageindex=" + (pageindex - 1) + "' );void(0);\">上一页</a>";
					}
					else
					{
						pageControl += "<span class=\"foosun_pagebox_num\">上一页</span>";
					}

					for (int i = currentStart; i < (currentStart + 5 > pagecount ? pagecount + 1 : currentStart + 5); i++)
					{
						if (pageindex == i)
						{
							pageControl += "<span class=\"foosun_pagebox_num_nonce\">" + i + "</span>";
						}
						else
						{
							pageControl += "<a href=\"javascript:JsReloader('" + context + "_script','/customform/CustomFormList.aspx?divid=" + context + "&pageindex=" + (i) + "' );void(0);\">" + i + "</a>";
						}
					}

					if (pageindex >= pagecount)
					{
						pageControl += "<span class=\"foosun_pagebox_num\">下一页</span>";
					}
					else
					{
						pageControl += "<a href=\"javascript:JsReloader('" + context + "_script','/customform/CustomFormList.aspx?divid=" + context + "&pageindex=" + (pageindex + 1) + "' );void(0);\">下一页</a>";
					}

					if (pageindex > pagecount - 5)
					{
						pageControl += "<span class=\"foosun_pagebox_num\">下五页</span>";
					}
					else
					{
						pageControl += "<a href=\"javascript:JsReloader('" + context + "_script','/customform/CustomFormList.aspx?divid=" + context + "&pageindex=" + (currentStart + 5) + "');void(0);\">下五页</a>";
					}
					pageControl += "</div>";
				}
				return pageControl;
			}
			pagecount = 0;
			recordCount = 0;
			return "";
		}


		/// <summary>
		/// 得到当前页列表的具体信息
		/// </summary>
		/// <param name="mystyle">列表样式</param>
		/// <param name="tablename">查询的表名</param>
		/// <param name="pagesize">每页大小</param>
		/// <param name="recordCount">总记录数</param>
		/// <param name="pageCount">总页码数</param>
		/// <param name="pageindex">当前页码</param>
		/// <returns>当前页列表的具体信息</returns>
		public string getControl(string mystyle, string tablename, string pagesize, out int recordCount, out int pageCount, int pageindex)
		{
			if (mystyle == null || mystyle == string.Empty || mystyle == "")
			{
				recordCount = 0;
				pageCount = 0;
				return null;
			}
			else
			{
				MatchCollection formItems = Regex.Matches(mystyle, "\\{#form_item_([^\\}]+)\\}", RegexOptions.Compiled);
				foreach (Match item in formItems)
				{
					mystyle = mystyle.Replace(item.Value, "");
				}

				MatchCollection formCtrs = Regex.Matches(mystyle, "\\{#form_ctr_([^\\}]+)\\}", RegexOptions.Compiled);
				foreach (Match item in formCtrs)
				{
					mystyle = mystyle.Replace(item.Value, "");
				}

				MatchCollection formValues = Regex.Matches(mystyle, "\\{#form_value_([^\\}]+)\\}", RegexOptions.Compiled);
				mystyle = searchValues(tablename, Convert.ToInt32(pagesize), pageindex, out recordCount, out pageCount, mystyle, formValues);
			}
			return mystyle;
		}



		/// <summary>
		/// 循环数据，为数据加上指定的样式
		/// </summary>
		/// <param name="tablename">要循环数据表</param>
		/// <param name="pagesize">每页大小</param>
		/// <param name="pageindex">当前页编号</param>
		/// <param name="recordCount">总记录数</param>
		/// <param name="pageCount">总页码数</param>
		/// <param name="mystyle">数据样式</param>
		/// <param name="formValues">正则表达式匹配的值格式</param>
		/// <returns></returns>
		private string searchValues(string tablename, int pagesize, int pageindex, out int recordCount, out int pageCount, string mystyle, MatchCollection formValues)
		{
			WFinger.CMS.Label l = new WFinger.CMS.Label();
			DataTable dt = l.searchValues(tablename, pageindex, pagesize, out recordCount, out pageCount);
			string info = string.Empty;
			for (int i = 0; i < pagesize; i++)
			{
				string temp = mystyle;
				if (dt.Rows.Count <= i)
				{
					break;
				}
				foreach (Match item in formValues)
				{
					if (dt.Columns.Contains(item.Groups[1].Value))
					{
						temp = temp.Replace(item.Value, dt.Rows[i][item.Groups[1].Value].ToString());
					}
					else
					{
						temp = temp.Replace(item.Value,"");
					}
				}
				info += temp;
			}
			return info;
		}




		/// <summary>
		/// FS:LabelType=List标签处理函数
		/// </summary>
		/// <returns></returns>
		public string Analyse_List(string Tags, string isConstr)
		{
			string mystyle = this.Mass_Inserted;
			string styleid = Regex.Match(mystyle, @"\[\#FS:StyleID=(?<sid>[^\]]+)]", RegexOptions.Compiled).Groups["sid"].Value.Trim();
			if (!styleid.Equals(string.Empty))
			{
				mystyle = LabelStyle.GetStyleByID(styleid);
			}
			if (mystyle.Trim().Equals(string.Empty))
				return string.Empty;

			string str_NewsType = this.GetParamValue("FS:NewsType");
			string str_SubNews = this.GetParamValue("FS:SubNews");
			string str_ClassID = this.GetParamValue("FS:ClassID");
			string str_SpecialID = this.GetParamValue("FS:SpecialID");
			int n_Cols;
			if (!int.TryParse(this.GetParamValue("FS:Cols"), out n_Cols))
				n_Cols = 1;
			if (n_Cols < 1)
				n_Cols = 1;
			string str_Desc = this.GetParamValue("FS:Desc");
			string str_DescType = this.GetParamValue("FS:DescType");
			string str_isDiv = this.GetParamValue("FS:isDiv");
			if (str_isDiv == null)
			{
				str_isDiv = "true";
			}
			string str_isPic = this.GetParamValue("FS:isPic");
			string str_TitleNumer = this.GetParamValue("FS:TitleNumer");
			string str_ContentNumber = this.GetParamValue("FS:ContentNumber");
			string str_NaviNumber = this.GetParamValue("FS:NaviNumber");
			string str_ClickNumber = this.GetParamValue("FS:ClickNumber");
			string str_ShowDateNumer = this.GetParamValue("FS:ShowDateNumer");
			string str_isSub = this.GetParamValue("FS:isSub");
			string str_ShowNavi = this.GetParamValue("FS:ShowNavi");
			string str_NaviCSS = this.GetParamValue("FS:NaviCSS");
			string str_ColbgCSS = this.GetParamValue("FS:ColbgCSS");
			string str_NaviPic = this.GetParamValue("FS:NaviPic");
			string str_HashNaviContent = this.GetParamValue("FS:HashNaviContent");
			string str_ClassStyleId = this.GetParamValue("FS:ClassStyleID");
			string str_More = this.GetParamValue("FS:More");
			string SqlFields = " [ID],ClassID";
			string SqlCondition = DBConfig.TableNamePrefix + "News Where [isRecyle]=0 And [isLock]=0 And [SiteID]='" + this.Param_SiteID + "'";
			if (str_HashNaviContent != null)
			{
				if (str_HashNaviContent == "false")
				{
					SqlCondition += " and  NaviContent=''";
				}
				else if (str_HashNaviContent == "true")
				{
					SqlCondition += " and NaviContent<>''";
				}
			}
			///判断新闻类型
			switch (str_NewsType)
			{
				case "Last":
					break;
				case "Rec":
					SqlCondition += " And NewsProperty like '1%'";
					break;
				case "Hot":
					SqlCondition += " And NewsProperty like '____1%'";
					break;
				case "Tnews":
					SqlCondition += " And NewsProperty like '________1%'";
					break;
				case "ANN":
					SqlCondition += " And NewsProperty like '__________1%'";
					break;
				case "MarQuee":
					SqlCondition += " And NewsProperty like '__1%'";
					break;
				case "Special":
					if (str_SpecialID != null)
					{
						SqlCondition += " And [NewsID] In (Select [NewsID] From [" + DBConfig.TableNamePrefix + "special_news] Where [SpecialID]='" + str_SpecialID + "')";
					}
					else if (this.Param_CurrentSpecialID != null)
					{
						SqlCondition += " And [NewsID] In (Select [NewsID] From [" + DBConfig.TableNamePrefix + "special_news] Where [SpecialID]='" + this.Param_CurrentSpecialID + "')";
					}
					else
					{
						return "专题新闻标签参数错误";
					}
					break;
				case "SubNews":
					if (this.Param_CurrentClassID != null)
					{
						return getSubNewsList(mystyle, styleid, n_Cols, str_Desc, str_DescType, str_isDiv, "",
							   "", str_isPic, str_TitleNumer, str_ContentNumber, str_NaviNumber, str_ClickNumber,
							   str_ShowDateNumer, str_ShowNavi, str_NaviCSS, str_ColbgCSS, str_NaviPic, str_SubNews, str_ClassStyleId);
					}
					else
					{
						return "";
					}
				case "Jnews":
					SqlCondition += " And NewsProperty like '______________1%'";
					break;
				default:
					break;
			}

			//-------判断是否调用图片
			if (str_isPic == "true")
			{
				SqlCondition += " And [NewsType]=1";
			}
			else if (str_isPic == "false")
			{
				SqlCondition += " And ([NewsType]=0 Or [NewsType]=2)";
			}
			//-------判断是否显示点击率大于多少
			if (str_ClickNumber != null && str_ClickNumber != string.Empty)
			{
				SqlCondition += " And [Click] >= " + int.Parse(str_ClickNumber);
			}
			//-------判断显示最近多少天内信息
			if (str_ShowDateNumer != null && str_ShowDateNumer != "")
			{

				if (WFinger.Config.UIConfig.WebDAL.ToLower() == "wfinger.accessdal")
				{
					SqlCondition += " And DateDiff('d',[CreatTime] ,Now()) < " + int.Parse(str_ShowDateNumer);
				}
				else
				{
					SqlCondition += " And DateDiff(day,[CreatTime] ,GetDate()) < " + int.Parse(str_ShowDateNumer);
				}
			}
			//判断是否相关新闻
			if (Tags != null && Tags != "")
			{
				string whereTags = string.Empty;
				string[] tagsList = Tags.Split('|');
				string t = null;
				for (int l = 0; l < tagsList.Length; l++)
				{
					t = tagsList[l];
					if (l == 0)
					{
						whereTags = "[Tags]='" + t + "'";
					}
					else
					{
						whereTags += "or [Tags]='" + t + "'";
					}
				}
				SqlCondition += " And (" + whereTags + ") and [NewsID] <>'" + Param_CurrentNewsID + "'";
			}
			//判断是否投稿新闻
			if (isConstr == "1")
			{
				SqlCondition += " And [isConstr]=1";
			}

			string SqlOrderBy = string.Empty;
			//-------排序
			//if (str_NewsType == "Last")
			//{
			//    SqlOrderBy += " order by ID Desc";
			//}
			//else
			//{
			if (str_Desc != null && str_Desc.ToLower() == "asc")
			{
				SqlOrderBy += " asc";
			}
			else
			{
				SqlOrderBy += " Desc";
			}
			switch (str_DescType)
			{
				case "id":
					SqlOrderBy = " Order By id " + SqlOrderBy + "";
					break;
				case "date":
					SqlOrderBy = " Order By [CreatTime] " + SqlOrderBy + ",id " + SqlOrderBy + "";
					break;
				case "click":
					SqlOrderBy = " Order By [Click] " + SqlOrderBy + ",id " + SqlOrderBy + "";
					break;
				case "pop":
					SqlOrderBy = " Order By [OrderID]" + SqlOrderBy + ",id " + SqlOrderBy + "";
					break;
				case "digg":
					SqlOrderBy = " Order By [TopNum]" + SqlOrderBy + ",id " + SqlOrderBy + "";
					break;
				default:
					if (str_NewsType == "Hot")
					{
						SqlOrderBy = " Order By [Click] " + SqlOrderBy + ",id " + SqlOrderBy + "";
					}
					else
					{
						SqlOrderBy = " Order By [CreatTime] " + SqlOrderBy + ",id " + SqlOrderBy + "";
					}
					break;
			}
			//}
			#region 对栏目进行判断
			string str_SubNaviCSS = string.Empty;
			bool subTF = false;
			if (str_SubNews != null)
			{
				if (str_SubNews == "true")
				{
					subTF = true;
					if (this.GetParamValue("FS:SubNaviCSS") != null)
					{
						str_SubNaviCSS = this.GetParamValue("FS:SubNaviCSS");
					}
				}
			}
			string Sql = string.Empty;
			#region 子类
			if (str_ClassID == null || str_ClassID == "0")
			{
				if (str_isSub == "true")
				{
					if (this._TemplateType == TempType.Class)
					{
						SqlCondition += " And [ClassID] In (" + getChildClassID(this.Param_CurrentClassID) + ")";
					}
				}
				if (this._TemplateType == TempType.Class)
				{
					SqlCondition += " And [ClassID]='" + this.Param_CurrentClassID + "'";
					Sql = "select top " + Param_Loop + "  " + SqlFields + " from " + SqlCondition + " " + SqlOrderBy;
				}
				else
				{
					Sql = "select top " + Param_Loop + " " + SqlFields + " from " + SqlCondition + SqlOrderBy;
				}
			}
			else if (str_ClassID == "-1")
			{
				Sql = "select top " + Param_Loop + " " + SqlFields + " from " + SqlCondition + SqlOrderBy;
			}
			else
			{
				if (str_isSub == "true")
				{
					SqlCondition += " And [ClassID] In (" + getChildClassID(str_ClassID) + ")";
				}
				else
				{
					SqlCondition += " And [ClassID] ='" + str_ClassID + "'";
				}
				Sql = "select top " + Param_Loop + " " + SqlFields + " from " + SqlCondition + SqlOrderBy;
			}
			#endregion
			#endregion 对栏目进行判断
			DataTable dt = CommonData.DalPublish.ExecuteSql(Sql);
			if (dt == null || dt.Rows.Count < 1) return string.Empty;
			string str_newslist = string.Empty;
			int i;
			int nTitleNum = 30, nContentNum = 200, nNaviNumber = 200;
			if (str_TitleNumer != null && WFinger.Common.Input.IsInteger(str_TitleNumer))
			{
				nTitleNum = int.Parse(str_TitleNumer);
			}
			if (str_ContentNumber != null && WFinger.Common.Input.IsInteger(str_ContentNumber))
			{
				nContentNum = int.Parse(str_ContentNumber);
			}
			if (str_NaviNumber != null && WFinger.Common.Input.IsInteger(str_NaviNumber))
			{
				nNaviNumber = int.Parse(str_NaviNumber);
			}
			int dtcount = dt.Rows.Count;

			string[] arr_ColbgCSS = null;
			bool b_ColbgCss = false;
			if (str_ColbgCSS != null)
			{
				arr_ColbgCSS = str_ColbgCSS.Split('|');
				b_ColbgCss = true;
			}

			string row = "";
			#region 滚动新闻已经屏蔽,前台js控制滚动,滚动新闻只做为一个属性
			//滚动新闻已经修改为前台用js代码控制滚动了。by Simplt
			//if (str_NewsType == "MarQuee")
			//{
			//    string marqueestr = "";

			//    if (str_MarqDirec == null)
			//        str_MarqDirec = "left";
			//    if (str_MarqSpeed == null)
			//        str_MarqSpeed = "10";
			//    if (str_Marqwidth == null)
			//        str_Marqwidth = "100";
			//    if (str_Marqheight == null)
			//        str_Marqheight = "40";
			//    if (str_isDiv == "false")
			//    {
			//        str_newslist += "<table >" + newLine;
			//        str_newslist += "<tr>" + newLine + "</td>" + newLine;
			//        str_newslist += "<script language=\"javascript\">" + newLine;
			//        marqueestr += "<marquee onmouseover=\"this.stop()\" onmouseout=\"this.start()\" scrollDelay=\"110\" scrollamount=\"" + str_MarqSpeed + "\" direction=\"" + str_MarqDirec + "\" height=\"" + str_Marqheight + "\" width=\"" + str_Marqwidth + "\">";
			//        for (i = 0; i < dtcount; i++)
			//        {
			//            if (str_MarqDirec == "left" || str_MarqDirec == "right")
			//            {
			//                marqueestr += getNavi(str_ShowNavi, str_NaviCSS, str_NaviPic, i) + " ";
			//                marqueestr += Analyse_ReadNews((int)dt.Rows[i][0], nTitleNum, nContentNum, nNaviNumber, mystyle, styleid, 1, 1, 0) + " ";
			//            }
			//            else
			//            {
			//                marqueestr += getNavi(str_ShowNavi, str_NaviCSS, str_NaviPic, i) + " ";
			//                marqueestr += Analyse_ReadNews((int)dt.Rows[i][0], nTitleNum, nContentNum, nNaviNumber, mystyle, styleid, 1, 1, 0) + " ";
			//                marqueestr += "<br />";
			//            }
			//        }
			//        marqueestr += "</marquee>";
			//        marqueestr = marqueestr.Replace("\r\n", "");
			//        string str_randnumber = WFinger.Common.Rand.Number(5);
			//        str_newslist += "var marqueestr" + str_randnumber + "='" + marqueestr + "';" + newLine;
			//        str_newslist += "document.write(marqueestr" + str_randnumber + "); " + newLine;
			//        str_newslist += "</script>" + newLine;
			//        str_newslist += "</td>" + newLine + "</tr>" + "</table>";
			//        dt.Clear();
			//        dt.Dispose();
			//    }
			//}
			#endregion
			string ClassURLs = string.Empty;
			for (i = 0; i < dtcount; i++)
			{
				PubClassInfo dc = CommonData.GetClassById(dt.Rows[i]["ClassID"].ToString());// DalPublish.GetsClassInfo(dt.Rows[i]["ClassID"].ToString());
				if (dc != null)
				{
					ClassURLs = getClassURL(dc.Domain, dc.isDelPoint, dc.ClassID, dc.SavePath, dc.SaveClassframe, dc.ClassSaveRule, dc.IsURL, dc.URLaddress);
				}
				str_ColbgCSS = "";
				if (b_ColbgCss)
				{
					if (i % 2 == 0)
						str_ColbgCSS = " class=\"" + arr_ColbgCSS[0].ToString() + "\"";
					else
						str_ColbgCSS = " class=\"" + arr_ColbgCSS[1].ToString() + "\"";
				}

				if (str_isDiv == "true")
				{
					if (b_ColbgCss)
					{
						str_newslist += "<span" + str_ColbgCSS + ">";
					}
					str_newslist += getNavi(str_ShowNavi, str_NaviCSS, str_NaviPic, i);
					str_newslist += Analyse_ReadNews((int)dt.Rows[i][0], nTitleNum, nContentNum, nNaviNumber, mystyle, styleid, 1, 1, 0);
					//开始调用副新闻
					if (subTF)
					{
						WFinger.Model.NewsContent sNCI = new WFinger.Model.NewsContent();
						sNCI = this.getNewsInfo((int)dt.Rows[i][0], null);
						str_newslist += getSubSTR(sNCI.NewsID, str_SubNaviCSS);
					}
					if (b_ColbgCss)
						str_newslist += "</span>";
				}
				else
				{
					str_isDiv = "false";
					row = getNavi(str_ShowNavi, str_NaviCSS, str_NaviPic, i) + " ";
					row += Analyse_ReadNews((int)dt.Rows[i][0], nTitleNum, nContentNum, nNaviNumber, mystyle, styleid, 1, 1, 0);
					//开始调用副新闻
					if (subTF)
					{
						WFinger.Model.NewsContent sNCI = new WFinger.Model.NewsContent();
						sNCI = this.getNewsInfo((int)dt.Rows[i][0], null);
						row += getSubSTR(sNCI.NewsID, str_SubNaviCSS);
					}
					if (n_Cols == 1)
					{
						str_newslist += "<tr>" + newLine + "<td" + str_ColbgCSS + ">" + newLine + row + newLine + "</td>" + newLine + "</tr>" + newLine;
					}
					else
					{
						row = "<td width=\"" + (100 / n_Cols) + "%\"" + str_ColbgCSS + ">" + newLine + row + newLine + "</td>" + newLine;
						if (i > 0 && ((i + 1) % n_Cols == 0))
							row += "</tr>" + newLine + "<tr>" + newLine;
						str_newslist += row;
					}
				}
			}
			dt.Clear();
			dt.Dispose();
			//要控制一行显示多少条，可以在前台用CSS控制<li>的属性
			if (str_isDiv == "false")
			{
				if (str_newslist != string.Empty && n_Cols > 1)
				{
					str_newslist = "<tr>" + newLine + str_newslist;
					if (i % n_Cols != 0)
					{
						int n = n_Cols - i;
						if (n < 0)
						{
							n = n_Cols - (i % n_Cols);
						}
						for (int j = 0; j < n; j++)
						{
							str_newslist += "<td width=\"" + (100 / n_Cols) + "%\">" + newLine + " </td>" + newLine;
						}
					}
					str_newslist += "</tr>" + newLine;
				}
			}
			if (str_newslist.EndsWith(@"<tr></tr>"))
			{
				str_newslist = str_newslist.Substring(0, str_newslist.Length - @"<tr></tr>".Length);
			}
			str_newslist = News_List_Head(str_isDiv, "", "") + str_newslist;
			//str_newslist += str_newslist;
			//获取更多
			//str_newslist += "<div style=\"width:100%;\" align=\"right\"><a href=\"" + ClassURLs + "\" target=\"_blank\"><img src=\"" + gdimm + "/sysImages/normal/more.gif\" border=\"0\" /></a></div>";
			if (!string.IsNullOrEmpty(str_More))
			{
				string gdimm = WFinger.Config.UIConfig.dirDumm;
				if (gdimm.Trim() != string.Empty)
				{
					gdimm = "/" + gdimm;
				}

				if (str_More.EndsWith(@".gif") || str_More.EndsWith(@".jpg"))
				{
					str_More = str_More.ToLower().Replace(@"{@dirfile}", WFinger.Config.UIConfig.dirFile);
					str_newslist += "<div style=\"width:100%;\" align=\"right\"><a href=\"" + ClassURLs + "\" target=\"_blank\"><img src=\"" + str_More + "\" border=\"0\"></img></a></div>";
				}
				else
				{
					str_newslist += "<div style=\"width:100%;\" align=\"right\"><a href=\"" + ClassURLs + "\" target=\"_blank\">" + str_More + "</a></div>";
				}
			}
			str_newslist += News_List_End(str_isDiv);
			return str_newslist;
		}

		/// <summary>
		/// 取得子类新闻列表
		/// </summary>
		/// <param name="mystyle">样式内容</param>
		/// <param name="styleid">样式编号</param>
		/// <param name="n_Cols">循环多少列</param>
		/// <param name="str_Desc">排序方式</param>
		/// <param name="str_DescType">按照什么排序</param>
		/// <param name="str_isDiv">输出方式（table or div）</param>
		/// <param name="str_ulID">div ul id</param>
		/// <param name="str_ulClass">div ul class</param>
		/// <param name="str_isPic">是否图片新闻</param>
		/// <param name="str_TitleNumer">标题字数</param>
		/// <param name="str_ContentNumber">内容字数</param>
		/// <param name="str_NaviNumber">导航字数</param>
		/// <param name="str_ClickNumber">点击次数</param>
		/// <param name="str_ShowDateNumer">显示多久日期的新闻</param>
		/// <param name="str_ShowNavi">是否显示导航</param>
		/// <param name="str_NaviCSS">导航样式</param>
		/// <param name="str_ColbgCSS">背景样式</param>
		/// <param name="str_NaviPic">导航图片</param>
		/// <param name="str_SubNews">是否调用副新闻</param>
		/// <param name="str_ClassStyle">子类栏目名称样式</param>
		/// <returns>返回子类新闻</returns>
		protected string getSubNewsList(string mystyle, string styleid, int n_Cols, string str_Desc, string str_DescType, string str_isDiv, string str_ulID, string str_ulClass, string str_isPic, string str_TitleNumer, string str_ContentNumber, string str_NaviNumber, string str_ClickNumber, string str_ShowDateNumer, string str_ShowNavi, string str_NaviCSS, string str_ColbgCSS, string str_NaviPic, string str_SubNews, string str_ClassStyleId)
		{
			//此处如果为div则需要修改。后期修改。
			string SqlFields = " [ID] ";
			string SqlCondition = DBConfig.TableNamePrefix + "News Where [isRecyle]=0 And [isLock]=0 And [SiteID]='" + this.Param_SiteID + "'";
			//-------判断是否调用图片
			if (str_isPic == "true")
				SqlCondition += " And [NewsType]=1";
			else if (str_isPic == "false")
				SqlCondition += " And ([NewsType]=0 Or [NewsType]=2)";
			//-------判断是否显示点击率大于多少
			if (str_ClickNumber != null && str_ClickNumber != "")
				SqlCondition += " And [Click] > " + int.Parse(str_ClickNumber);
			//-------判断显示最近多少天内信息
			if (str_ShowDateNumer != null && str_ShowDateNumer != "")
			{
				if (WFinger.Config.UIConfig.WebDAL.ToLower() == "wfinger.accessdal")
				{
					SqlCondition += " And DateDiff('d',[CreatTime] ,now()) < " + int.Parse(str_ShowDateNumer);
				}
				else
				{
					SqlCondition += " And DateDiff(Day,[CreatTime] ,Getdate()) < " + int.Parse(str_ShowDateNumer);
				}
			}
			string SqlOrderBy = string.Empty;
			//-------排序
			if (str_Desc != null && str_Desc.ToLower() == "asc")
				SqlOrderBy += " asc";
			else
				SqlOrderBy += " Desc";
			switch (str_DescType)
			{
				case "id":
					SqlOrderBy = " Order By id " + SqlOrderBy + "";
					break;
				case "date":
					SqlOrderBy = " Order By [CreatTime] " + SqlOrderBy + ",id " + SqlOrderBy + "";
					break;
				case "click":
					SqlOrderBy = " Order By [Click] " + SqlOrderBy + ",id " + SqlOrderBy + "";
					break;
				case "pop":
					SqlOrderBy = " Order By [OrderID]" + SqlOrderBy + ",id " + SqlOrderBy + "";
					break;
				case "digg":
					SqlOrderBy = " Order By [TopNum]" + SqlOrderBy + ",id " + SqlOrderBy + "";
					break;
				default:
					SqlOrderBy = " Order By [CreatTime] " + SqlOrderBy + ",id " + SqlOrderBy + "";
					break;
			}

			int nTitleNum = 30, nContentNum = 200, nNaviNumber = 200;
			if (str_TitleNumer != null && WFinger.Common.Input.IsInteger(str_TitleNumer))
			{
				nTitleNum = int.Parse(str_TitleNumer);
			}
			if (str_ContentNumber != null && WFinger.Common.Input.IsInteger(str_ContentNumber))
			{
				nContentNum = int.Parse(str_ContentNumber);
			}
			if (str_NaviNumber != null && WFinger.Common.Input.IsInteger(str_NaviNumber))
			{
				nNaviNumber = int.Parse(str_NaviNumber);
			}

			string str_SubNaviCSS = string.Empty;
			bool subTF = false;
			if (str_SubNews != null)
			{
				if (str_SubNews == "true")
				{
					subTF = true;
					if (this.GetParamValue("FS:SubNaviCSS") != null)
					{
						str_SubNaviCSS = this.GetParamValue("FS:SubNaviCSS");
					}
				}
			}
			string[] arr_ColbgCSS = null;
			bool b_ColbgCss = false;
			if (str_ColbgCSS != null)
			{
				arr_ColbgCSS = str_ColbgCSS.Split('|');
				b_ColbgCss = true;
			}
			string row = "";
			string Sql = " Select [IsURL],[URLaddress],[ClassID],[ClassCName],[SavePath],[SaveClassframe],[ClassSaveRule],[ClassSaveRule],[isDelPoint] ,[Domain] From [" + DBConfig.TableNamePrefix + "news_Class] Where [ParentID]='" + this.Param_CurrentClassID + "' And [isRecyle]=0 And [isLock]=0 And [IsURL]=0";
			DataTable dt = CommonData.DalPublish.ExecuteSql(Sql);
			if (dt == null || dt.Rows.Count == 0) return "";
			StringBuilder htmlCode = new StringBuilder();
			//栏目名称样式
			string styleContent = LabelStyle.GetStyleByID(str_ClassStyleId);
			if (str_isDiv == "false")
			{
				htmlCode.AppendLine("<table border=\"0\">");
			}
			for (int i = 0; i < dt.Rows.Count; i++)
			{
				string classrow = PlaceClassStyle(styleContent, dt.Rows[i]);

				if (str_isDiv == "true")//使用Div + css
				{
					htmlCode.AppendLine("<div class=\"Foosun_Sys_ClassInfo\">");
					htmlCode.AppendLine(classrow);
				}
				else//使用table
				{
					htmlCode.AppendLine("<tr>");
					htmlCode.AppendLine("<td>");
					htmlCode.AppendLine(classrow);
					htmlCode.AppendLine("</td>");
					htmlCode.AppendLine("</tr>");
					htmlCode.AppendLine("<tr>");
					htmlCode.AppendLine("<td>");
				}

				#region 栏目下的新闻
				string s_newsSql = "select top " + Param_Loop + " " + SqlFields + " from" +
										   " " + SqlCondition + " And [ClassID]='" + dt.Rows[i]["ClassID"].ToString() + "'" + SqlOrderBy;
				DataTable dv = CommonData.DalPublish.ExecuteSql(s_newsSql);
				if (dv != null)
				{
					htmlCode.Append(News_List_Head(str_isDiv, str_ulID, str_ulClass));
					int dvCount = dv.Rows.Count;
					if (str_isDiv != "true" && dvCount > 0 && n_Cols > 1)
					{
						htmlCode.AppendLine("<tr>");
					}
					for (int j = 0; j < dv.Rows.Count; j++)
					{
						str_ColbgCSS = "";
						if (b_ColbgCss)
						{
							if (j % 2 == 0)
								str_ColbgCSS = " class=\"" + arr_ColbgCSS[0].ToString() + "\"";
							else
								str_ColbgCSS = " class=\"" + arr_ColbgCSS[1].ToString() + "\"";
						}

						if (str_isDiv == "true")
						{
							if (b_ColbgCss)
							{
								htmlCode.Append("<span" + str_ColbgCSS + ">");
							}
							htmlCode.Append(getNavi(str_ShowNavi, str_NaviCSS, str_NaviPic, j));
							htmlCode.AppendLine(Analyse_ReadNews((int)dv.Rows[j][0], nTitleNum, nContentNum, nNaviNumber, mystyle, styleid, 1, 1, 0));
							//开始调用副新闻
							if (subTF)
							{
								WFinger.Model.NewsContent sNCI = new WFinger.Model.NewsContent();
								sNCI = this.getNewsInfo((int)dv.Rows[j][0], null);
								htmlCode.Append(getSubSTR(sNCI.NewsID, str_SubNaviCSS));
							}
							if (b_ColbgCss)
							{
								htmlCode.Append("</span>");
							}
						}
						else
						{
							str_isDiv = "false";
							row = getNavi(str_ShowNavi, str_NaviCSS, str_NaviPic, j) + " ";
							row += Analyse_ReadNews((int)dv.Rows[j][0], nTitleNum, nContentNum, nNaviNumber, mystyle, styleid, 1, 1, 0);
							//开始调用副新闻
							if (subTF)
							{
								WFinger.Model.NewsContent sNCI = new WFinger.Model.NewsContent();
								sNCI = this.getNewsInfo((int)dt.Rows[j][0], null);
								row += getSubSTR(sNCI.NewsID, str_SubNaviCSS);
							}
							if (n_Cols == 1)
							{
								htmlCode.AppendLine("<tr>");
								htmlCode.AppendLine("<td" + str_ColbgCSS + ">");
								htmlCode.AppendLine(row);
								htmlCode.AppendLine("</td>");
								htmlCode.AppendLine("</tr>");
							}
							else
							{
								htmlCode.AppendLine("<td width=\"" + (100 / n_Cols) + "%\"" + str_ColbgCSS + ">");
								htmlCode.AppendLine(row);
								htmlCode.AppendLine("</td>");

								if (j > 0 && ((j + 1) % n_Cols == 0))
								{
									htmlCode.AppendLine("</tr>");
									htmlCode.AppendLine("<tr>");
								}
							}
						}
					}

					dv.Clear();
					dv.Dispose();
					if (str_isDiv != "true" && dvCount > 0 && n_Cols > 1)
					{
						if (dvCount % n_Cols != 0)
						{
							int n = n_Cols - dvCount;
							if (n < 0)
							{
								n = n_Cols - (dvCount % n_Cols);
							}
							for (int k = 0; k < n; k++)
							{
								htmlCode.AppendLine("<td width=\"" + (100 / n_Cols) + "%\">");
								htmlCode.AppendLine("</td>");
							}
						}
						htmlCode.AppendLine("</tr>");
					}
					htmlCode.Append(News_List_End(str_isDiv));
				}
				#endregion
				if (str_isDiv == "false")
				{
					htmlCode.AppendLine("</td>");
					htmlCode.AppendLine("</tr>");
				}
				else
				{
					htmlCode.AppendLine("</div>");
				}
			}
			dt.Clear(); dt.Dispose();

			if (str_isDiv == "false")
			{
				htmlCode.AppendLine("</table>");
			}
			return htmlCode.ToString();
		}

		protected string PlaceClassStyle(string classStyle, DataRow classInfo)
		{
			//{#class_NaviPic}{#class_Keywords}{#class_Descript}{#class_Navi}{#class_Name}{#class_EName}{#class_Path}
			//栏目中文名称--------------------------------------------------------------------------------------------------------
			if (classStyle.IndexOf("{#class_Name}") > -1)
			{
				if (classInfo != null)
					classStyle = classStyle.Replace("{#class_Name}", classInfo["ClassCName"].ToString());
				else
					classStyle = classStyle.Replace("{#class_Name}", "");
			}
			//栏目英文名称--------------------------------------------------------------------------------------------------------
			if (classStyle.IndexOf("{#class_EName}") > -1)
			{
				if (classInfo != null)
				{
					classStyle = classStyle.Replace("{#class_EName}", classInfo["ClassEName"].ToString());
				}
				else
				{
					classStyle = classStyle.Replace("{#class_EName}", "");
				}
			}
			//栏目编号
			if (classStyle.IndexOf("{#class_ID}") > -1)
			{
				if (classInfo != null)
				{
					classStyle = classStyle.Replace("{#class_ID}", classInfo["ClassID"].ToString());
				}
				else
				{
					classStyle = classStyle.Replace("{#class_ID}", "");
				}
			}
			//栏目访问路径--------------------------------------------------------------------------------------------------------
			if (classStyle.IndexOf("{#class_Path}") > -1)
			{
				if (classInfo != null)
				{
					classStyle = classStyle.Replace("{#class_Path}", getClassURL(classInfo["Domain"].ToString(), Convert.ToInt32(classInfo["isDelPoint"]), classInfo["ClassID"].ToString(), classInfo["SavePath"].ToString(), classInfo["SaveClassframe"].ToString(), classInfo["ClassSaveRule"].ToString(), Convert.ToInt32(classInfo["IsURL"]), classInfo["URLaddress"].ToString()));
				}
				else
					classStyle = classStyle.Replace("{#class_Path}", "");
			}
			//栏目信息:导读--------------------------------------------------------------------------------------------------------
			if (classStyle.IndexOf("{#class_Navi}") > -1)
			{
				if (classInfo != null)
					classStyle = classStyle.Replace("{#class_Navi}", classInfo["NaviContent"].ToString());
				else
					classStyle = classStyle.Replace("{#class_Navi}", "");
			}
			//栏目信息:meta关键字--------------------------------------------------------------------------------------------------------
			if (classStyle.IndexOf("{#class_Keywords}") > -1)
			{
				if (classInfo != null)
					classStyle = classStyle.Replace("{#class_Keywords}", classInfo["MetaKeywords"].ToString());
				else
					classStyle = classStyle.Replace("{#class_Keywords}", "");
			}
			//栏目信息:meta描述--------------------------------------------------------------------------------------------------------
			if (classStyle.IndexOf("{#class_Descript}") > -1)
			{
				if (classInfo != null)
					classStyle = classStyle.Replace("{#class_Descript}", classInfo["MetaDescript"].ToString());
				else
					classStyle = classStyle.Replace("{#class_Descript}", "");
			}
			return classStyle;
		}


		/// <summary>
		/// Get NewsList Table Or Div
		/// </summary>
		/// <param name="isDiv">是否输出DIV</param>
		/// <param name="ulID">DIV的ul属性ID</param>
		/// <param name="ulClass">DIV的ul属性Class</param>
		/// <returns>返回头部</returns>
		protected string News_List_Head(string isDiv, string ulID, string ulClass)
		{
			string str_Head = string.Empty;
			if (string.IsNullOrEmpty(isDiv) || isDiv == "false")
			{
				str_Head += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">" + newLine;
			}
			else
			{   //此项已屏蔽，无须定义ul的属性，在前台模板中控制。这样的好处可以得到纯w3c格式的div+css
				//if (ulID != null && ulClass != null)
				//    str_Head += "<ul id=\"" + ulID + "\" class=\"" + ulClass + "\">" + newLine;
				//else if (ulID != null && ulClass == null)
				//    str_Head += "<ul id=\"" + ulID + "\">" + newLine;
				//else if (ulID == null && ulClass != null)
				//    str_Head += "<ul class=\"" + ulClass + "\">" + newLine;
				//else
				str_Head += newLine;
			}
			return str_Head;
		}

		/// <summary>
		/// Get NewsList Table Or Div
		/// </summary>
		/// <param name="isDiv">是否输出DIV</param>
		/// <returns>返回尾部</returns>
		protected string News_List_End(string isDiv)
		{
			if (isDiv == "true")
				return newLine;
			else
				return "</table>" + newLine;
		}
		/// <summary>
		/// 获取标题前导航
		/// </summary>
		/// <param name="ShowNavi">是否显示导航</param>
		/// <param name="NaviPic">导航图片地址</param>
		/// <param name="i">当前循环的记录数</param>
		/// <returns>返回导航</returns>
		protected string getNavi(string ShowNavi, string NaviCSS, string NaviPic, int i)
		{
			string strNavi = string.Empty;
			string strNaviCSS = string.Empty;
			string strNaviCSS_1 = string.Empty;
			if (NaviCSS != null && NaviCSS != "")
			{
				//如果navicss为空，可以在前台CSS中控制<dd>的属性,by simplt
				strNaviCSS = "<dd class=\"" + NaviCSS + "\">";
				strNaviCSS_1 = "</dd>";
			}
			switch (ShowNavi)
			{
				case "1":
					i++;
					strNavi = strNaviCSS + i.ToString() + strNaviCSS_1;
					break;
				case "2":
					if (i <= 26)
						strNavi = strNaviCSS + ((char)(i + 65)).ToString() + strNaviCSS_1;
					break;
				case "3":
					if (i <= 26)
						strNavi = strNaviCSS + ((char)(i + 97)).ToString() + strNaviCSS_1;
					break;
				case "4":
					strNavi = "<img border=\"0\" src=\"" + RelpacePicPath(NaviPic) + "\" />";
					break;
				default:
					break;
			}
			return strNavi + " ";
		}
	}
}
